package com.ruoyi.SuveryInterface.SuveryUtils.util;

import sun.misc.BASE64Decoder;

import java.io.File;
import java.io.FileOutputStream;

public class ReturnCardPhoto {
	public static boolean ReturnPhoto(String photo, String photoFullName) {
		BASE64Decoder decoder = new BASE64Decoder();
		// photoFullName包含全路径和文件名，例如 E:/picture/123.jpeg
		// photo base64编码转成String类型
		try {
			// 照片转成图片格式，保存到本地
			FileOutputStream write = new FileOutputStream(new File(photoFullName));
			byte[] decoderBytes = decoder.decodeBuffer(photo);
			write.write(decoderBytes);
			write.close();

			// 读取本地照片，做响应处理，如上传到指定服务器等。
			// BufferedImage image = ImageIO.read(new File(photoFullName));
			return true;
		} catch (Exception e) {
		}
		return false;
	}
}
